﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NicoView.Model.Share.Speech;
using NicoView.Model.Share.Speech.Learn;
using System.Speech.Synthesis;


namespace NicoView.Model.Platform.Speachers.Sapi
{
    public sealed class SapiSpeacher:SpeacherBase<GeneralLearnModel>
    {
        public SapiSpeacher(string name, RegexLearnDictionary regexDictionary, LearnDictionary dictionary)
            : base(regexDictionary,dictionary)
        {
            _synthesizer = new SpeechSynthesizer();
            _synthesizer.SelectVoice(name);

        }


        private SpeechSynthesizer _synthesizer;



        protected override void Synthesize(SynthesizeArgs args)
        {

            _synthesizer.Speak(args.Body + " " + args.Name);
           
        }

        public override void Dispose()
        {
            _synthesizer.Dispose();
        }

        public override string Name
        {
            get { return this._synthesizer.Voice.Name; }
        }

        public override void SpeechCancel()
        {
            
        }
    }
}
